﻿using System;
using System.ComponentModel;
using UtfprLibrary.ComponentModel.Security;

namespace UtfprLibrary.Windows.Forms.ComponentModel {
    /// <summary>
    /// Provides a unified way of converting types of values to other types, as well as for accessing standard values and subproperties.
    /// </summary>
    public class UtfprRestrictionConverter : TypeConverter {
        /// <summary>
        /// Default constructor
        /// </summary>
        public UtfprRestrictionConverter() { }
        
        /// <summary>
        /// Returns whether this object supports properties.
        /// </summary>
        /// <param name="context">An ITypeDescriptorContext that provides a format context.</param>
        /// <returns></returns>
        public override bool GetPropertiesSupported(ITypeDescriptorContext context) {
            return true;
        }

        /// <summary>
        /// TODO
        /// Returns a collection of properties for the type of array specified by the value parameter, using the specified context and attributes.
        /// </summary>
        /// <param name="context"> 
        /// An ITypeDescriptorContext that provides a format context.
        /// </param>
        /// <param name="value">An Object that specifies the type of array for which to get properties.</param>
        /// <param name="attributes">An array of type Attribute that is used as a filter.</param>
        /// <returns>a collection of <see cref="UtfprLibrary.Windows.Forms.UtfprRestriction"/> properties
        /// A PropertyDescriptorCollection with the properties that are exposed for this data type, or null if there are no properties.
        /// </returns>
        public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, object value, Attribute[] attributes) {
            return TypeDescriptor.GetProperties(typeof(IUtfprRestriction));
        }
    }
}
